/*
 * @Author: shengduiliang 1107722390@qq.com
 * @Date: 2024-05-04 16:49:56
 * @LastEditors: shengduiliang 1107722390@qq.com
 * @LastEditTime: 2024-05-05 16:58:57
 * @FilePath: /treasure/src/ui-components/text-input/index.tsx
 * @Description: 输入框组件
 */
import { Input, InputProps, View } from "@tarojs/components"
import { memo } from "react"
import './index.scss'

interface TextInputProps extends InputProps {
  label: string
  onChange?: (value: string) => void
}

const TextInput = (props: TextInputProps) => {
  
  return (
    <View className='text-input pv-normal-mh-normal'>
      <View className='row-start-center'>
        <View className='label text-primary-bold'>{props.label}</View>
        <Input
          className='textarea text-primary flex-1'
          placeholderClass='text-secondary'
          onInput={(e) => { props.onChange && props.onChange(e.detail.value) }}
          {...props}
        />
      </View>
    </View>
  )
}

export default memo(TextInput)